<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:t="http://www.w3.org/1999/xhtml">
<head th:replace="components/easyui/easyui-list :: head('用户表', 'easyui,upload,ueditor')">
<body>
<form id="form_edit">
                <div>
                    <input class="easyui-numberbox" id="edit_id" name="id" data-options="label:'id:', width:300, required:true" th:value="${oauthUser.id}">
                </div>
                <div>
                    <input class="easyui-textbox" id="edit_username" name="username" data-options="label:'用户名:', width:300, required:true" th:value="${oauthUser.username}">
                </div>
                <div>
                    <input class="easyui-textbox" id="edit_password" name="password" data-options="label:'密码:', width:300, required:true" th:value="${oauthUser.password}">
                </div>
                <!--<div>
                    <input class="easyui-textbox" id="edit_enabled" name="enabled" data-options="label:'有效:', width:300, required:true" th:value="${oauthUser.enabled}">
                </div>-->
                <div>
                    <t:dict class="easyui-combobox" id="edit_enabled" name="enabled" dict-name="enabled_status" data-options="label:'有效:', width:300, required:true"></t:dict>
                </div>
                <div>
                    <input class="easyui-textbox" id="edit_areaCode" name="areaCode" data-options="label:'手机区号:', width:300, required:true" th:value="${oauthUser.areaCode}">
                </div>
                <div>
                    <input class="easyui-textbox" id="edit_phone" name="phone" data-options="label:'手机号:', width:300, required:true" th:value="${oauthUser.phone}">
                </div>
                <div>
                    <input class="easyui-textbox" id="edit_email" name="email" data-options="label:'邮箱:', width:300, required:true" th:value="${oauthUser.email}">
                </div>
                <div>
                    <input class="easyui-textbox" id="edit_address" name="address" data-options="label:'地址:', width:300, required:true" th:value="${oauthUser.address}">
                </div>
                <div>
                    <input class="easyui-numberbox" id="edit_age" name="age" data-options="label:'年龄:', width:300, required:true" th:value="${oauthUser.age}">
                </div>
                <div>
                    <input class="easyui-datetimebox" id="edit_birth" name="birth" data-options="label:'生日:', width:300, required:true" th:value="${oauthUser.birth}">
                </div>
                <div>
                    <label style="width: 80px;float:left;">头像:</label>
                    <div th:replace="components/toolbar :: file-upload (idVal='edit_headPhoto',nameVal='headPhoto')" style="width:94%;float:left;"></div>
                    <div style="clear:both"></div>
                </div>
                <div>
                    <input class="easyui-textbox" id="edit_personBrief" name="personBrief" data-options="label:'个人简介:', width:300, required:true" th:value="${oauthUser.personBrief}">
                </div>
                <div>
                    <t:dict class="easyui-combobox" id="edit_sex" name="sex" dict-name="sex_type" data-options="label:'性别:', width:300, multiple:false"></t:dict>
                </div>
                <div>
                    <input class="easyui-textbox" id="edit_visitCard" name="visitCard" data-options="label:'邀请码:', width:300, required:true" th:value="${oauthUser.visitCard}">
                </div>
                <div>
                    <t:dict class="easyui-combobox" id="edit_loginType" name="loginType" dict-name="login_type" data-options="label:'登录方式:', width:300, multiple:false"></t:dict>
                </div>
                <div>
                    <t:dict class="easyui-combobox" id="edit_loginStatus" name="loginStatus" dict-name="login_status" data-options="label:'登录状态:', width:300, multiple:false"></t:dict>
                </div>
                <div>
                    <input class="easyui-datetimebox" id="edit_loginDate" name="loginDate" data-options="label:'登录时间:', width:300, required:true" th:value="${oauthUser.loginDate}">
                </div>
    <div style="text-align:center;pediting:5px 0">
        <a href="javascript:void(0)" class="button button-rounded button-small button-primary" onclick="edit()" th:text="#{ok}"></a>
        <a href="javascript:void(0)" class="button button-rounded button-small" onclick="clearForm()" th:text="#{cancel}"></a>
    </div>
</form>
<div id="dlg" class="easyui-dialog" data-options="title:'图片信息',closed:true" style="width:480px;height:480px;pediting:10px"></div>
<div id="window_content" class="easyui-window" title="内容详情" data-options="modal:true,closed:true,collapsible:false" style="width:720px;height:480px;pediting:10px;"></div>
<div th:replace="components/easyui/easyui-list :: js('easyui,upload,ueditor')"></div>
<script th:inline="javascript">
    /*<![CDATA[*/
    $(function () {
        //实例化编辑器
        //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
        /*var editEditor = UE.getEditor('edit_editor', {
            autoHeight: false
        });*/
        //初始化图片上传按钮
        initFileUpload('#edit_headPhoto', 'headPhoto');
        //显示预览图片
        imgPreview('#edit_headPhoto', 'headPhoto', [[${oauthUser.headPhoto}]]);

        $('#edit_enabled').combobox('setValue', String([[${oauthUser.enabled}]]));
        $('#edit_sex').combobox('setValue', String([[${oauthUser.sex}]]));
        $('#edit_loginType').combobox('setValue', String([[${oauthUser.loginType}]]));
        $('#edit_loginStatus').combobox('setValue', String([[${oauthUser.loginStatus}]]));
    });

    function edit() {
        doRequest({
            formId: '#form_edit',
            url: '/api/oauthUsers/edit',
            type: 'PATCH',
            extraData: {
            }
    });
    }

    function clearForm() {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }

    /*]]>*/
</script>
</body>
</html>